package com.smcdd.cdb.dbo.cdb_dbo.ui.activity;

import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;

import com.smcdd.cdb.dbo.cdb_dbo.R;
import com.smcdd.cdb.dbo.cdb_dbo.service.presenter.QueryPresenter;
import com.smcdd.cdb.dbo.cdb_dbo.service.view.IQueryAc;
import com.smcdd.cdb.dbo.cdb_dbo.ui.base.BaseActivity;
import com.smcdd.cdb.dbo.cdb_dbo.ui.utils.ObtainUdis;
import com.smcdd.cdb.dbo.cdb_dbo.ui.widget.SideBar;



/**
 * 作者：Administrator on 2017/6/28 11:13
 * 邮箱：zhanghuaiha@gmail.com
 *  所属店铺
 */

public class QueryActivity extends BaseActivity<IQueryAc,QueryPresenter> implements IQueryAc {


    private SideBar mSidebar;
    private TextView mDialog;
    private ListView mListView;
    private ImageView net_back;


    @Override
    public void initView() {
        mSidebar = (SideBar) findViewById(R.id.wx_fg_contact_sb);
        mDialog = (TextView) findViewById(R.id.wx_fg_contact_dialog);
        mListView = (ListView) findViewById(R.id.wx_fg_contact_lv);
        net_back = (ImageView) findViewById(R.id.net_back);
    }

    @Override
    public void initData() {
        String udid = ObtainUdis.getUDID(QueryActivity.class);
        mPresenter.loadContacts(udid);
        mSidebar.setTextView(mDialog);
    }

    @Override
    public void initListener() {
        net_back.setOnClickListener(v -> finish());
    }

    @Override
    protected QueryPresenter createPresenter() {
        return new QueryPresenter(this);
    }


    @Override
    protected int provideContentViewId() {
        return R.layout.activity_query;
    }

    @Override
    public ListView getListView() {
        return mListView;
    }

    @Override
    public SideBar getSideBar() {
        return mSidebar;
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        mPresenter.unLoadData();
    }
}
